package com.ruihu.admin.module.business.tasknode.controller;

import com.ruihu.admin.common.controller.BaseController;
import com.ruihu.admin.common.domain.PageResultDTO;
import com.ruihu.admin.common.domain.ResponseDTO;
import com.ruihu.admin.common.domain.ValidateList;
import com.ruihu.admin.module.business.tasknode.domain.dto.NodeInstProcessRelationAddDTO;
import com.ruihu.admin.module.business.tasknode.domain.dto.NodeInstProcessRelationQueryDTO;
import com.ruihu.admin.module.business.tasknode.domain.dto.NodeInstProcessRelationUpdateDTO;
import com.ruihu.admin.module.business.tasknode.domain.vo.NodeInstProcessRelationVO;
import com.ruihu.admin.module.business.tasknode.service.NodeInstProcessRelationService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * [  ]
 *
 * @author Tony
 * @version 1.0
 * @company 瑞虎（南京）信息技术有限公司
 * @copyright (c)  瑞虎（南京）信息技术有限公司Inc. All rights reserved.
 * @date 2023-01-03 14:55:43
 * @since JDK1.8
 */
@RestController
@Api(tags = {""})
public class NodeInstProcessRelationController extends BaseController {

    @Autowired
    private NodeInstProcessRelationService nodeInstProcessRelationService;

    @ApiOperation(value = "分页查询",notes = "@author Tony")
    @PostMapping("/nodeInstProcessRelation/page/query")
    public ResponseDTO<PageResultDTO<NodeInstProcessRelationVO>> queryByPage(@RequestBody NodeInstProcessRelationQueryDTO queryDTO) {
        return nodeInstProcessRelationService.queryByPage(queryDTO);
    }

    @ApiOperation(value = "添加",notes = "@author Tony")
    @PostMapping("/nodeInstProcessRelation/add")
    public ResponseDTO<String> add(@RequestBody @Validated NodeInstProcessRelationAddDTO addTO){
        return nodeInstProcessRelationService.add(addTO);
    }

    @ApiOperation(value="修改",notes = "@author Tony")
    @PostMapping("/nodeInstProcessRelation/update")
    public ResponseDTO<String> update(@RequestBody @Validated NodeInstProcessRelationUpdateDTO updateDTO){
        return nodeInstProcessRelationService.update(updateDTO);
    }

    @ApiOperation(value="批量更新",notes = "@author Tony")
    @PostMapping("/nodeInstProcessRelation/batchUpdate")
    public ResponseDTO<String> batchUpdateByIds(@RequestBody @Validated List<NodeInstProcessRelationUpdateDTO> relations){
        return nodeInstProcessRelationService.batchUpdateByIds(relations);
    }

    @ApiOperation(value="批量删除",notes = "@author Tony")
    @PostMapping("/nodeInstProcessRelation/deleteByIds")
    public ResponseDTO<String> delete(@RequestBody @Validated ValidateList<Long> idList) {
        return nodeInstProcessRelationService.deleteByIds(idList);
    }

}
